package com.chenyongjing.design.pattern.proxy.dynamicUsualProxy;

import com.chenyongjing.design.pattern.proxy.staticUasualProxy.UserService;
import com.chenyongjing.design.pattern.proxy.staticUasualProxy.UserServiceImpl;

public class Client {
    public static void main(String[] args) {
        //真实角色
        UserServiceImpl userService = new UserServiceImpl();
        // 代理角色
        ProxyInvocationHandler pih = new ProxyInvocationHandler();
        // 设置需要代理的对象
        pih.setRent(userService);
        // 动态生成代理类
        UserService proxy = (UserService) pih.getProxy();
        proxy.delete();

    }
}
